Merge "installer: Run the LESS compiler for *.less files"
authorMarkAHershberger <mhershberger@wikimedia.org>
Mon, 28 Oct 2013 21:39:31 +0000 (21:39 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 28 Oct 2013 21:39:31 +0000 (21:39 +0000)
1  2 
includes/installer/Installer.php
includes/resourceloader/ResourceLoader.php
resources/Resources.php

@@@ -302,8 -302,7 +302,8 @@@ abstract class Installer 
        /**
         * URL to mediawiki-announce subscription
         */
 -      protected $mediaWikiAnnounceUrl = 'https://lists.wikimedia.org/mailman/subscribe/mediawiki-announce';
 +      protected $mediaWikiAnnounceUrl =
 +              'https://lists.wikimedia.org/mailman/subscribe/mediawiki-announce';
  
        /**
         * Supported language codes for Mailman
                        $this->showMessage( 'config-using-server', $server );
                        $this->setVar( 'wgServer', $server );
                }
 +
                return true;
        }
  
                $IP = dirname( dirname( __DIR__ ) );
                $this->setVar( 'IP', $IP );
  
 -              $this->showMessage( 'config-using-uri', $this->getVar( 'wgServer' ), $this->getVar( 'wgScriptPath' ) );
 +              $this->showMessage(
 +                      'config-using-uri',
 +                      $this->getVar( 'wgServer' ),
 +                      $this->getVar( 'wgScriptPath' )
 +              );
  
                return true;
        }
                        }
                }
  
 -              // Uses messages 'config-unicode-using-php', 'config-unicode-using-utf8', 'config-unicode-using-intl'
 +              // Uses messages 'config-unicode-using-php', 'config-unicode-using-utf8',
 +              // 'config-unicode-using-intl'
                if ( $useNormalizer === 'php' ) {
                        $this->showMessage( 'config-unicode-pure-php-warning' );
                } else {
  
                // Some of the environment checks make shell requests, remove limits
                $GLOBALS['wgMaxShellMemory'] = 0;
+               // Don't bother embedding images into generated CSS, which is not cached
+               $GLOBALS['wgResourceLoaderLESSFunctions']['embeddable'] = function( $frame, $less ) {
+                       return $less->toBool( false );
+               };
        }
  
        /**
@@@ -592,7 -592,7 +592,7 @@@ class ResourceLoader 
         * and clear out the output buffer. If the client cache is too old then do nothing.
         * @param $context ResourceLoaderContext
         * @param string $mtime The TS_MW timestamp to check the header against
 -       * @return bool True iff 304 header sent and output handled
 +       * @return bool True if 304 header sent and output handled
         */
        protected function tryRespondLastModified( ResourceLoaderContext $context, $mtime ) {
                // If there's an If-Modified-Since header, respond with a 304 appropriately
        public static function getLessCompiler() {
                global $wgResourceLoaderLESSFunctions, $wgResourceLoaderLESSImportPaths;
  
+               // When called from the installer, it is possible that a required PHP extension
+               // is missing (at least for now; see bug 47564). If this is the case, throw an
+               // exception (caught by the installer) to prevent a fatal error later on.
+               if ( !function_exists( 'ctype_digit' ) ) {
+                       throw new MWException( 'lessc requires the Ctype extension' );
+               }
                $less = new lessc();
                $less->setPreserveComments( true );
                $less->setVariables( self::getLESSVars() );
diff --combined resources/Resources.php
@@@ -87,7 -87,7 +87,7 @@@ return array
                'localBasePath' => $GLOBALS['wgStyleDirectory'],
        ),
        'skins.vector' => array(
-               // Keep in sync with WebInstallerOutput::getCSS()
+               // Used in the web installer. Test it after modifying this definition!
                'styles' => array(
                        'common/commonElements.css' => array( 'media' => 'screen' ),
                        'common/commonContent.css' => array( 'media' => 'screen' ),
        ),
        'mediawiki.inspect' => array(
                'scripts' => 'resources/mediawiki/mediawiki.inspect.js',
 -              'dependencies' => 'jquery.byteLength',
 +              'dependencies' => array(
 +                      'jquery.byteLength',
 +                      'jquery.json',
 +              ),
                'targets' => array( 'desktop', 'mobile' ),
        ),
        'mediawiki.feedback' => array(
                'localBasePath' => $GLOBALS['wgStyleDirectory'],
        ),
        'mediawiki.legacy.config' => array(
+               // Used in the web installer. Test it after modifying this definition!
                'scripts' => 'common/config.js',
-               'styles' => array( 'common/config.css', 'common/config-cc.css' ),
+               'styles' => array( 'common/config.css' ),
                'remoteBasePath' => $GLOBALS['wgStylePath'],
                'localBasePath' => $GLOBALS['wgStyleDirectory'],
                'dependencies' => 'mediawiki.legacy.wikibits',
                'position' => 'top',
        ),
        'mediawiki.legacy.shared' => array(
+               // Used in the web installer. Test it after modifying this definition!
                'styles' => array( 'common/shared.css' => array( 'media' => 'screen' ) ),
                'remoteBasePath' => $GLOBALS['wgStylePath'],
                'localBasePath' => $GLOBALS['wgStyleDirectory'],